# Maintainer: David Macek <david.macek.0@gmail.com>

_realname=editrights
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.03
pkgrel=5
pkgdesc="Edit special privileges of Windows accounts (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
url="https://cygwin.org/"
license=('spdx:BSD-3-Clause')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=("https://mirrors.kernel.org/sourceware/cygwin/x86_64/release/${_realname}/${_realname}-${pkgver}-1-src.tar.xz"
        'uncygwinize.patch')
sha256sums=('c38718c87af54bde0c6c96b8dcf407b95ed8dc141d9970d39a8eb77ef0129da8'
            'b84e66761b8cd691a07c4f61c552e18f992d801db0401559cd733f0261895fa6')


prepare(){
  tar -xjf ${_realname}-${pkgver}-1.src/${_realname}-${pkgver}.tar.bz2
  patch -p1 -i "${srcdir}/uncygwinize.patch"
}

build() {
  cd ${_realname}
  make clean
  make
}

package() {
  cd ${_realname}
  make DESTDIR="${pkgdir}" PREFIX=${MINGW_PREFIX} install
  install -Dm0644 LICENCE ${pkgdir}${MINGW_PREFIX}/share/licenses/editrights/LICENCE
  mv ${pkgdir}${MINGW_PREFIX}/share/doc/{Cygwin,editrights}
}
